public class test9 {
    public static void main(String[] args) {
        Node a = new Node(1);
        Node b = new Node(2);
        Node c = new Node(3);
        Node d = new Node(4);
        Node e = new Node(5);
        Node f = new Node(6);

        a.next = b;
        b.next = c;
        c.next = d;
        d.next = e;
        e.next = f;

        boolean result = getList(a);
        System.out.println(result);
    }

    public static boolean getList(Node head){
        if (head == null||head.next == null)
            return false;

        // 环形链表 一个指针走一步,一个走两步
        Node cur1 = head;
        Node cur2 = head;
        while (cur2!=null&&cur2.next!=null){
            cur2 = cur2.next.next;
            cur1 = cur1.next;
            if(cur2 == cur1)
                return true;
        }
        return false;
    }
}
